import { InsightItem, UserInfoUpdates, UserProfile } from '@/models/user-info'
import { PageParams, Pagination } from '../../models/sys'
import { http } from '@/utils/http'

/** 列表 */
export const getUserInfoList = (params: PageParams) => {
  return http.get<Pagination<InsightItem>>('/library-client/api/wxwork/user-info/list', params)
}

/** 编辑用户洞察 */
export const editUserInfo = (params: { id: number; content: string }) => {
  return http.post('/library-client/api/wxwork/user-info/edit-user-insight', params)
}

/** 删除用户洞察 */
export const deleteUserInfo = (params: { id: number }) => {
  return http.post('/library-client/api/wxwork/user-info/delete-user-insight', params)
}

/** 编辑用户画像 */
export const editUserPortrait = (params: { id: number; value: string }) => {
  return http.post('/library-client/api/wxwork/user-info/edit-user-profile', params)
}

/** 丢弃 */
export const discardUserInfo = (params: { id: number }) => {
  return http.post('/library-client/api/wxwork/user-info/discard', params)
}

/** 确认 */
export const confirmUserInfo = (params: { id: number; student_id: number }) => {
  return http.post('/library-client/api/wxwork/user-info/confirm', params)
}

/** 检查最新的数据 */
export const checkLatestUserInfo = (params?: { start_id: number; latest_id: number }) => {
  return http.get<UserInfoUpdates>('/library-client/api/wxwork/user-info/latest', params)
}

/** 编辑用户画像提交 */
export const editUserPortraitSubmit = (params: { list: UserProfile[] }) => {
  return http.post<UserInfoUpdates>(
    '/library-client/api/wxwork/user-info/batch-edit-user-profile',
    params.list,
  )
}
